home *** CD-ROM | disk | FTP | other *** search
- #include <clib/all_protos.h>
- #include <exec/types.h>
- #include <math.h>
- #include <float.h>
-
- extern LONG xtemp,MaxCnt,CurCnt;
- extern double XCenter,Factor,Limit,Two;
- extern UWORD Color;
- extern ULONG *LPixelBuf,*ColorTable32;
- extern int BPP;
-
- extern void PlotIt(void);
-
- void UseLibP2(double yRel)
- {
- double xRel,Zr,Zi,Zr2,Zi2,Z2;
- ULONG *ColSrc;
- xRel = xtemp;
- xRel = xRel - XCenter;
- Zr = xRel/Factor;
- Zi = yRel;
- xRel = Zr;
- CurCnt = 1; /* Initialize Counter */
- while (CurCnt < MaxCnt) {
- Zr2 = Zr*Zr; /* Find Zr^2 */
- Zi2 = Zi*Zi; /* Find Zi^2 */
- Z2 = Zr2+Zi2; /* Find Zr^2 + Zi^2 */
- if (Z2 > Limit) { /* is |Z| > 2*Factor */
- if (BPP >= 2) {
- ColSrc = (ULONG *)ColorTable32 + (ULONG)CurCnt;
- *LPixelBuf++ = *ColSrc;
- }
- else {
- Color = CurCnt;
- PlotIt();
- }
- return;
- }
- Zi = Two*Zi*Zr; /* Find original Zi * Zr */
- Zr2 = Zr2 - Zi2; /* Find Zr^2 - Zi^2 */
- Zr = xRel + Zr2; /* Find New Zr */
- Zi = yRel + Zi; /*Add in original Zi to get new Zi */
- CurCnt++;
- }
-
- if (BPP >= 2) {
- ColSrc = (ULONG *)ColorTable32 + 0xffff;
- *LPixelBuf++ = *ColSrc;
- }
- else {
- Color = 0xffff;
- PlotIt();
- }
-
- return;
- }
-
-